//
//  ResponderChainAdvancedTwoViewController.m
//  OCUIBootcamp
//
//  Created by 周晓旺 on 2023/11/30.
//

#import "ResponderChainAdvancedTwoViewController.h"
#import <Masonry.h>
#import "RCButton.h"
@interface ResponderChainAdvancedTwoViewController ()

@end

@implementation ResponderChainAdvancedTwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = UIColor.lightGrayColor;
    [self responderChain3];

}
// MARK: - 3.扩大Button的响应范围
- (void)responderChain3 {
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = UIColor.yellowColor;
    [self.view addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(80);
        make.left.right.equalTo(self.view);
        make.height.equalTo(self.view.mas_height).multipliedBy(0.3);
    }];
    
    RCButton *biggerBtn = [RCButton buttonWithType:UIButtonTypeCustom];
    biggerBtn.tag = 100;
    biggerBtn.backgroundColor = UIColor.blackColor;
    [biggerBtn addTarget:self action:@selector(biggerBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
    [bgView addSubview:biggerBtn];
    [biggerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(bgView).offset(80);
        make.right.equalTo(bgView.mas_right).offset(-60);
        make.bottom.equalTo(bgView).offset(-40);
        make.left.equalTo(bgView).offset(60);
    }];
    biggerBtn.touchInsets = UIEdgeInsetsMake(-20, -20, -20, -20);
    [self.view layoutIfNeeded];
}
- (void)biggerBtnClicked:(UIButton *)btn {
    NSLog(@"点击范围扩大的黑色Btn的点击事件");
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
